package cn.com.klun.tjy.other.zkUsed;

import java.util.ArrayList;
import java.util.List;

/**
 * 设置成单例模式
 */
public class ChildrenCache {
    private static ChildrenCache childrenCache;
    private static List<String> cache = new ArrayList<>();

    public static List<String> getCache() {
        return cache;
    }

    /**
     * @param cache
     */
    public static void setCache(List<String> cache) {
        ChildrenCache.cache = cache;
    }
    // 私有化 构造器
    private ChildrenCache() {
    }
    //线程安全 懒汉式
    public static synchronized ChildrenCache getInstance(){
        if(childrenCache == null){
            childrenCache = new ChildrenCache();
        }
        return childrenCache;
    }
}